from  flask_sqlalchemy import  SQLAlchemy
db=SQLAlchemy()
import datetime
# 充值记录表
class RechargeModel(db.Model):
    __tablename__ = 'recharge'
    id = db.Column(db.Integer, primary_key=True, comment='订单ID')
    order = db.Column(db.String(20),comment="订单号")
    full = db.Column(db.String(20),comment="充值类型")
    money = db.Column(db.String(20),comment="充值金额")
    deal = db.Column(db.String(20),comment="交易状态")
    usernamne = db.Column(db.String(20),comment="用户名")
    url = db.Column(db.String(256),comment="头像")
    mobile = db.Column(db.String(11),comment="手机号")
    dealtime = db.Column(db.String(256),comment="交易时间")
    r_id = db.Column(db.Integer,db.ForeignKey('user.id'))



# 提现记录表 （充值50+50收益）
class Withdraw(db.Model):
    id = db.Column(db.Integer, primary_key=True, comment='订单ID')
    order = db.Column(db.String(20), comment="订单号")
    money = db.Column(db.String(20), comment="提现金额")
    deal = db.Column(db.String(20), comment="交易状态")
    usernamne = db.Column(db.String(20), comment="用户名")
    url = db.Column(db.String(256), comment="头像")
    mobile = db.Column(db.String(11), comment="手机号")
    dealtime = db.Column(db.String(256), comment="交易时间")
    manager = db.Column(db.String(20),comment="审核管理员")
    w_id = db.Column(db.Integer,db.ForeignKey('user.id'))


# 抽成比例表
class CommissionModel(db.Model):
    id = db.Column(db.Integer, primary_key=True, comment='ID')


# 提现设置



# 工单分类表
class ClassifyModel(db.Model):
    __tablename__ = 'classify'
    id = db.Column(db.Integer, primary_key=True, comment='ID')
    name = db.Column(db.String(20),comment="分类名称")



# 工单表
class WorkOrder(db.Model):
    __tablename__ = 'workorder'
    id = db.Column(db.Integer, primary_key=True, comment='ID')
    userid = db.Column(db.String(20),comment="工单编号")
    username = db.Column(db.String(20),comment="用户名")
    mobile = db.Column(db.String(11),comment="手机号")
    lei = db.Column(db.String(20),comment="工单类别")
    report = db.Column(db.String(20),comment="举报")
    content = db.Column(db.String(20),comment="内容")
    url = db.Column(db.String(256),comment="图片")
    sponsor = db.Column(db.String(60),comment="发起时间")
    service = db.Column(db.String(20),comment="对接客服")
    state = db.Column(db.String(30),comment="处理状态")
    w_id = db.Column(db.Integer,db.ForeignKey('classify.id'))

# 通知告知表
class Inform(db.Model):
    id = db.Column(db.Integer, primary_key=True, comment='ID')
    ID = db.Column(db.String(20),comment="通告ID")
    headline = db.Column(db.String(30),comment="标题")
    page = db.Column(db.String(40),comment="所属页面")
    issue = db.Column(db.String(60),comment="发布时间")
    state = db.Column(db.String(30),comment="状态")

